#include "map.h"
#include "engine.h"
#include <iostream>



using namespace std;

char MapGrid::getState(int col, int row){
	return MapArray[col][row];
}

void MapGrid::setState(int col, int row, char value){
	MapArray[col][row] = value;
	cout << "State of " << col << " & " << row << " is = " << value << endl << flush;
}

void MapGrid::setCol(int col, char value){
	for (int i = 0; i < ROW; i++) MapArray[col][i] = value;
}

void MapGrid::PrintMap(){
	for (int icol = 0; icol < COL; icol++) {
		for (int irow = 0; irow < ROW; irow++) cout << MapArray[icol][irow] << flush;
		cout << endl;
	}
}

void MapGrid::emptyAll(){
	for (int icol = 0; icol < COL; icol++) {
		for (int irow = 0; irow < ROW; irow++) MapArray[icol][irow] = 'o';
	}
}

int MapGrid::getFirstBall(int row){
		GridStruct result;
		for (int i = 10; i != 0; i--) {
			if (MapArray[i][row] == '*'){
				return i;
			}
		}
	return 0;
}
